import { Validator } from 'vee-validate'

export default function created() {
    const dict = {
        custom: {
            username: {
                required: '用户名不能为空',
                min: '用户名至少由2个字符组成'
            },
            password: {
                required: '密码不能为空',
                min: '密码最少为6个字符',
                max: '密码最多为18个字符',
                confirmed: '两次密码不一致',
            }
        }
    };
    Validator.localize('custom', dict);
    this.validator = new Validator({
        username: 'required|min:2',
        password: 'required|min:6|max:18'
    });
    this.$set(this, 'errors', this.validator.errors);
}